
/**
 * 
 */
package com.sztx.pay.center.common.util;

import java.util.ArrayList;
import java.util.List;




/**
 * 
 * <一句话功能简述>
 * <功能详细描述>
 * 
 * @author  xiaosc
 * @version  [版本号, 2016年2月20日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public class Constance {
	
	public static final int TRADE_OVER_STATUS = 8;
	public static final int GUARANTEE_TRADE_NOTIFY_TYPE=6;
	
	public static final String USER_ID_SZTX = ConfigUtil.sztxUserId; //神州通行用户id
	
	public static final String CHANNEL_ID_SZTF = ConfigUtil.sztxChannelId;  //通付渠道id
	
	public static final String ACT_SZTX_CASH   = ConfigUtil.sztxCashActId;  //通行现金账户

	public static final String ACT_SZTX_TRADE  = ConfigUtil.sztxTradeActId;  //通行交易账户

	public static final String ACT_SZTX_PROFIT = ConfigUtil.sztxProfitActId;  //通行收益账户

	public static final String ACT_SZTX_REBATE = ConfigUtil.sztxRebatetActId;  //通行返利金账户
	
	public static final String SZTX_MER_ID = ConfigUtil.sztxMerId; //通付在通行的平台ID
	
	
	public static final String ACT_SIGIN    = ConfigUtil.actSigin;
	
	public static final String ACT_PROFIT   = ConfigUtil.actProfit;  //收益账户
	public static final String ACT_SZTX     = ConfigUtil.actSztx;  //通行总账户
	public static final String ACT_REBATE   = ConfigUtil.actRebate;  //通行返利金账户
	public static final String ACT_SCAN_REBATE   = ConfigUtil.actScanRebate;  //通行扫码付返利金账户
	
	
	public static final String USER_SZTX    = ConfigUtil.userSztx;  //通行用户
	public static final String USER_PROFIT  = ConfigUtil.userProfit;  //通行收益用户
	public static final String USER_REBATE  = ConfigUtil.userRebate;  //通行返利金用户
	public static final String USER_SCAN_REBATE  = ConfigUtil.userScanRebate;  //通行扫码付返利金用户
	
	

	public static final String SIGN_KEY = ConfigUtil.signKey;
	
	public static final String PAY_SDK_SZTF_RESULT_SUCCESS = "SUCCESS";
	
	public static final String TRANSFER_BANK_ID = ConfigUtil.transferBankId;
	
	public static final String CHARSET = "UTF-8";
	
	public static final String SIGN_TYPE = "md5";
	
	public static final String BERBON_PAY_BANKID = "0000000";//倍棒余额支付bankid
	public static final String CHANNEL_ID_SZTX = "000000";   //通行渠道id
	
	
	public static final String ORDER_PREFIX_BALANCE_TRANSFER = "25";   //通行渠道id
	
	//public static final String B2C_RETURN_URL = "http://cashier.berbon.com/callback/return";

	public final static int DEFAULT_PLATFORMID = 10;
	/*****您当前的余额为:{1}元,已低于设置的余额预警值:{2}元****/
	public final static String USER_ACT_ALERT_CMD = "USER_ACT_ALERT_CMD";
	public final static int maxAlertTimes = 3;//最大提醒次数
	
	public final static String YB_19FEI_PAYURL="http://www.19fei.com/ybpay";
	
	/**************绑卡***************/
	public final static String BIND_CARD_BUSINESS_TYPE="1022";
	
	public final static String BIND_CARD_START_WITH="BC";
	/**************绑卡默认金额  分**************/
	public final static int BIND_CARD_DEFAULT_AMOUNT=10;
	
	public static enum BindCardType {
		
		BIND_QUICK_PAY(1, "绑定快捷支付"),	
		BIND_WITHDRAW(2, "绑定提现卡"),
		BIND_ALIPAY(3, "绑定支付宝账号");
		
		private final int value;
		private final String desc;
		
		 BindCardType(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static BindCardType valueOf(int value){
			switch (value) {
			case 1:			
				return BIND_QUICK_PAY;
			case 2:
				return BIND_WITHDRAW;
			case 3:
				return BIND_ALIPAY;
			default:
				return null;
			}		
		}
	}
	
	public static enum BindCardStatus {
		UNAUTHORIZED(0, "未认证"),	
		BIND(1, "已绑定"),
		UNBIND(2, "已解绑"),
		BIND_FAILED(3,"绑定失败");
		
		private final int value;
		private final String desc;
		
		BindCardStatus(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static BindCardStatus valueOf(int value){
			switch (value) {
			case 0:			
				return UNAUTHORIZED;
			case 1:
				return BIND;
			case 2:
				return UNBIND;
			case 3:
				return BIND_FAILED;
			default:
				return null;
			}		
		}
	}
	
	public static enum PayType {
		BALANCE(1, "余额支付"),
		QUICK(2, "快捷支付"),
		ONLINE(3, "网银支付"),
		ALIPAY(4, "支付宝支付"),
		WXPAY(5, "微信支付");
		
		public static PayType valueOf(int code){			
			switch (code) {
			case 1:
				return BALANCE;
			case 2:
				return QUICK;
			case 3:
				return ONLINE;
			case 4:
				return ALIPAY;
			case 5:
				return WXPAY;
			default:
				return null;
			}			
		}
		
		int code;
		String desc;

		PayType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
	}
	
	public static enum GuaranteeType {
		QUICK(0, "及时交易"), 
		ORDINARY(1, "担保交易");

		int code;
		String desc;
		
		public static GuaranteeType valueOf(int code){			
			switch (code) {
			case 1:
				return QUICK;
			case 2:
				return ORDINARY;
			default:
				return null;
			}			
		}
		
		GuaranteeType(int code, String desc) {

			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
	}

	/**
	 * 银行卡类别
	 * @author 
	 *
	 */
	public static enum CardType {
	
		CARD_DEBIT(1, "借记卡"),	
		CARD_CREDIT(2, "信用卡"),
		CARD_DOUBLE(3, "双卡");
		
		private final int value;
		private final String desc;
		
		 CardType(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		public int getValue() {
			return value;
		}
		public String getDesc() {
			return desc;
		}
		public static CardType valueOf(int value){
			switch (value) {
			case 1:			
				return CARD_DEBIT;
			case 2:
				return CARD_CREDIT;
			case 3:
				return CARD_DOUBLE;
			default:
				return null;
			}		
		}
	}
	
	public static enum CardActType {
		CARD_ACT_PRIVATE(1, "对私账户"),	
		CARD_ACT_PUBLIC(2, "对公账户");
		
		private final int value;
		private final String desc;
		
		 CardActType(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		public int getValue() {
			return value;
		}
		public String getDesc() {
			return desc;
		}
		public static CardActType valueOf(int value){
			switch (value) {
			case 1:			
				return CARD_ACT_PRIVATE;
			case 2:
				return CARD_ACT_PUBLIC;
			default:
				return null;
			}		
		}
		
	}
	
	public static enum  TradeOrderType{	
		B2C_TRADE_ORDER(1,"B2C交易"),
		CHARGE_ORDER(2,"充值"),
		BALANCE_WITHDRAW_ORDER(3,"余额提现"),
		PROFIT_WITHDRAW_ORDER(4,"返利金提现"),
		TRANSFER_ORDER(5,"转账"),
		REFUND_ORDER(6,"退款"),
		SETTLE_ORDER(7,"结算"),		
		BIND_CARD_ORDER(8, "快捷支付绑卡"),
		TRADE_FEE(9, "交易手续费"),
		SETTLE_PROFIT(10, "结算返利金"),
		SETTLE_DISTRIBUTOR(11, "商户结算"),
		GRAY_USER(12, "灰度用户"),
		BALANCE_TRANSFER(13, "余额迁移"),
		FREEZE_MONEY(14, "冻结余额"),
		UNFREEZE_MONEY(15, "解冻余额"),
		PLUS_ADD_MONEY(16, "中间账户加款"),
		;

		
		int code;
		String desc;

		TradeOrderType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static TradeOrderType valueOf(int code){			
			switch (code) {
			case 1:
				return B2C_TRADE_ORDER;
			case 2:
				return CHARGE_ORDER;
			case 3:
				return BALANCE_WITHDRAW_ORDER;
			case 4:
				return PROFIT_WITHDRAW_ORDER;
			case 5:
				return TRANSFER_ORDER;
			case 6:
				return REFUND_ORDER;
			case 7:	
				return SETTLE_ORDER;
			case 8:	
				return BIND_CARD_ORDER;
			case 9:	
				return TRADE_FEE;
			case 10:	
				return SETTLE_PROFIT;
			case 11:	
				return SETTLE_DISTRIBUTOR;
			case 12:	
				return GRAY_USER;
			case 13:	
				return BALANCE_TRANSFER;
			case 16:	
				return PLUS_ADD_MONEY;
				
			default:
				return null;
			}			
		}
	}
	
	public static enum UserType{
		SZTX(1, "神州通行", 6),
		PERSON(2,"个人客户", 2),
		PARTNER(4,"商户", 6),
		AGENT(8, "代理商", 10),
		MPOS(16, "Mpos", 10);

		int code;
		String desc;
		int actType;
		

		UserType(int code, String desc, int actType) {
			this.code = code;
			this.desc = desc;
			this.actType = actType;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		public int getActType() {
			return actType;
		}

		public static UserType valueOf(int code){			
			switch (code) {
			case 1:
				return SZTX;
			case 2:
				return PERSON;
			case 4:
				return PARTNER;
			case 8:
				return AGENT;
			case 16:
				return MPOS;	
			default:
				return null;
			}			
		}
		
		public static List<UserType> listOf(int code){
			List<UserType> uList = new ArrayList<>();
			
			if ((code & 1) == 1) {
				uList.add(SZTX);
			}
			
			if ((code & 2) == 2) {
				uList.add(PERSON);
			}
			
			if ((code & 4) == 4) {
				uList.add(PARTNER);
			}
			
			if ((code & 8) == 8) {
				uList.add(AGENT);
			}
			
			if ((code & 16) == 16) {
				uList.add(MPOS);
			}
			
			if (!uList.isEmpty()) {
				return uList;
			}
			
			return null;
		}
	}
	
	
	public static enum UserActType{	
		TFAC(0, "通付账户",  1001, "000001", 0),
		SZTF(1, "通付账户",  1001, "000001", 0),
		CASH(2, "现金账户",  1021, "000000", 31),		
        TRADE(4, "交易账户", 1022, "000000", 5),
		JF(8, "缴费金账户", 1023, "000000", 8);
		
		int code;
		String desc;
		/** 账户规则生成的模板号*/
		int templateId;
		String channelId;
		int uType;
		
		UserActType(int code, String desc, int templateId, String channelId, int uType) {
			this.code = code;
			this.desc = desc;
			this.templateId = templateId;
			this.channelId = channelId;
			this.uType = uType;
		}
		
		public int getCode() {
			return code;
		}

		public String getDesc() {
			return desc;
		}

		public int getTemplateId() {
			return templateId;
		}
		
		public String getChannelId() {
			return channelId;
		}

		public void setChannelId(String channelId) {
			this.channelId = channelId;
		}
		
		public int getuType() {
			return uType;
		}

		public static UserActType valueOf(int code){
			
			switch (code) {
				case 1:				
					return SZTF;
				case 2:				
					return CASH;
				case 4:				
					return TRADE;
				case 8:				
					return JF;
			default:
				return null;
			}
		}
	}
	
	
	
	
//	public static enum ActType{
//		BALANCE_ACT(1, "余额账户"),
//		PROFIT_ACT (2, "返利金账户"),
//		BANK_ACT(3, "银行卡账户"),
//		ALIPAY_ACT(4, "支付宝账户"),
//		WEIXIN_ACT(5, "微信账户");		
//		
//		public static ActType valueOf(int code){			
//			switch (code) {
//			case 1:
//				return BALANCE_ACT;
//			case 2:
//				return PROFIT_ACT;
//			case 3:
//				return BANK_ACT;
//			case 4:
//				return ALIPAY_ACT;
//			case 5:
//				return WEIXIN_ACT;
//			default:
//				return null;
//			}			
//		}
//		
//		int code;
//		String desc;
//
//		ActType(int code, String desc) {
//			this.code = code;
//			this.desc = desc;
//		}
//
//		public int getCode() {
//			return code;
//		}
//
//		public void setCode(int code) {
//			this.code = code;
//		}
//
//		public String getDesc() {
//			return desc;
//		}
//
//		public void setDesc(String desc) {
//			this.desc = desc;
//		}
//	}
	
	public static enum DistributeType{	
		BANK(1, "银行卡账户"),
		ALIPAY(2, "支付宝账户");
		
		int code;
		String desc;

		DistributeType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
		
		public static DistributeType valueOf(int code){			
			switch (code) {
			case 1:
				return BANK;
			case 2:
				return ALIPAY;
			default:
				return null;
			}			
		}

		public int getCode() {
			return code;
		}

		public String getDesc() {
			return desc;
		}
	}
	
	public static enum ActLevel{
		LEVEL_V1(1, "未实名认证"),
		LEVEL_V2 (2, "身份信息更新"),
		LEVEL_V3(3, "有效证件正反面认证"),
		LEVEL_V4(4, "本人持证认证");
		
		public static ActLevel valueOf(int code){			
			switch (code) {
			case 1:
				return LEVEL_V1;
			case 2:
				return LEVEL_V2;
			case 3:
				return LEVEL_V3;
			case 4:
				return LEVEL_V4;
			default:
				return null;
			}			
		}
		
		int code;
		String desc;

		ActLevel(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
	}
	
	public static enum PayFlowType{
		PAY(1,"付款"),
		TRANSFER(2,"内转"),
		BATCH_TRASFER(3,"批量转账"),
		WITHDRAW(4, "提现"),
		DISTRIBUTE(5, "代发"),
		REFUND(6, "退款"),
		BALANCE_TRADE(7, "余额交易"),
		BALANCE_BATCH_TRASFER(8, "余额批量转账");
		
		int code;
		String desc;

		PayFlowType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		public static PayFlowType valueOf(int code){
			switch (code) {
				case 1:
					return PAY;
				case 2:
					return TRANSFER;
				case 3:
					return BATCH_TRASFER;
				case 4:
					return WITHDRAW;
				case 5:
					return DISTRIBUTE;
				case 6:
					return REFUND;
				case 7:
					return BALANCE_TRADE;
				case 8:
					return BALANCE_BATCH_TRASFER;
				default:	
					return null;
			}			
		}
	}
	
	public static enum B2COrderState{
		WAITING_PAY(1, "待支付"),
		PAYING(2,"支付中"),
		SUCCESS(3, "成功"),
		FAIL(4,"失败"),
		EXCEPTION(5,"异常"),
		REFUNDING(6,"退款中"),
		REFUND_SUCCESS(7,"退款成功"),
		TRADE_OVER(8,"交易完成"),
		SETTLING(9,"结算中"),
		SETTLE_FAIL(10,"结算失败"),
		SETTLE_EXCEPTION(11,"结算异常"),
		REFUND_FAIL(12,"退款失败"),
		REFUND_EXCEPTION(13,"退款异常");

		int code;
		String desc;

		B2COrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		public static B2COrderState valueOf(int code){			
			switch (code) {
			case 1:
				return WAITING_PAY;
			case 2:
				return PAYING;
			case 3:
				return SUCCESS;
			case 4:
				return FAIL;
			case 5:
				return EXCEPTION;
			case 6:	
				return REFUNDING;
			case 7:	
				return REFUND_SUCCESS;
			case 8:	
				return TRADE_OVER;	
			case 9:	
				return SETTLING;
			case 10:	
				return SETTLE_FAIL;
			case 11:	
				return SETTLE_EXCEPTION;
			case 12:	
				return REFUND_FAIL;
			case 13:	
				return REFUND_EXCEPTION;
			default:
				return null;
			}			
		}
	}
	
	public static enum PayFlowState{
		WAITING_PAY(1, "待支付"), 
		PAYING(2,"支付中"),
		SUCCESS(3, "成功"),
		FAIL(4,"支付失败"),
		EXCEPTION(5,"异常");

		int code;
		String desc;

		PayFlowState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		
		public static PayFlowState valueOf(int code){			
			switch (code) {
			case 1:
				return WAITING_PAY;
			case 2:
				return PAYING;
			case 3:
				return SUCCESS;
			case 4:
				return FAIL;
			case 5:
				return EXCEPTION;
			default:	
				return null;
			}			
		}	
	}
	
	public static enum PayFlowBatchState{
		SUCCESS(1, "成功"),
		FAIL(2,"失败"),
		EXCEPTION(3,"异常");
		
		int code;
		String desc;

		PayFlowBatchState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		public static PayFlowBatchState valueOf(int code){			
			switch (code) {
			case 1:
				return SUCCESS;
			case 2:
				return FAIL;
			case 3:
				return EXCEPTION;
			default:	
				return null;
			}			
		}	
	}
	
	public static enum ActState{
		NORMAL(1, "正常"), 
		STOP_PAY(2,"止付"),
		CANCELLATION(3, "注销");

		int code;
		String desc;

		ActState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		
		public static ActState valueOf(int code){			
			switch (code) {
			case 1:
				return NORMAL;
			case 2:
				return STOP_PAY;
			case 3:
				return CANCELLATION;
			default:	
				return null;
			}			
		}	
	}
	
	public static enum FreezedOperator{
		FREEZE(1, "冻结账户"), 
		UNFREEZE(2,"解冻账户"),
		CLOSE(3,"关闭账户");
		
		int code;
		String desc;

		FreezedOperator(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		public static FreezedOperator valueOf(int code){			
			switch (code) {
			case 1:
				return FREEZE;
			case 2:
				return UNFREEZE;
			case 3:
				return CLOSE;
			default:	
				return null;
			}			
		}	
	}
	
	public static enum WithdrawState{
		WITHDRAW_STATUS_INIT(0,"初始态"),
		WITHDRAW_STATUS_IN(1,"提现中"),
		WITHDRAW_STATUS_FAIL(2,"提现失败"),
		WITHDRAW_STATUS_SUCCESS(3,"提现成功"),
		WITHDRAW_STATUS_EXCEPTION(4,"异常"),
		WITHDRAW_DEBIT_SUCCESS(5,"扣款成功"),
		WITHDRAW_ORDER_FAIL_REFUND(6,"交易失败,退款"),
		WITHDRAW_ORDER_REFUND_FAIL(7,"退款失败"),
		WITHDRAW_ORDER_SUBMIT(8,"订单提交到银行");
		int code;
		String desc;

		WithdrawState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		public static WithdrawState valueOf(int code){			
			switch (code) {
			case 0:
				return WITHDRAW_STATUS_INIT;
			case 1:
				return WITHDRAW_STATUS_IN;
			case 2:
				return WITHDRAW_STATUS_FAIL;
			case 3:
				return WITHDRAW_STATUS_SUCCESS;
			case 4:
				return WITHDRAW_STATUS_EXCEPTION;
			case 5:
				return WITHDRAW_DEBIT_SUCCESS;
			case 6:
				return WITHDRAW_ORDER_FAIL_REFUND;
			case 7:
				return WITHDRAW_ORDER_REFUND_FAIL;
			case 8:
				return WITHDRAW_ORDER_SUBMIT;
			default:	
				return null;
			}			
		}
	}
	
	public static enum WithDrawType{
		WITHDRAW_BERBON(1,"提现余额"),
		WITHDRAW_REBATE(2,"提现返利金"),
		WITHDRAW_SCAN_REBATE(3,"提现扫码付返利金");
		int code;
		String desc;

		WithDrawType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static WithDrawType valueOf(int code){			
			switch (code) {
			case 1:
				return WITHDRAW_BERBON;
			case 2:
				return WITHDRAW_REBATE;
			case 3:
				return WITHDRAW_SCAN_REBATE;
			default:	
				return null;
			}			
		}
	}
	
	public static enum TransferOrderState{
		TRAN_STATUS_INIT(0,"初始态"),
		TRAN_STATUS_FAIL(1,"转账失败"),
		TRAN_STATUS_SUCCESS(2,"转账成功"),
		TRAN_STATUS_IN(3,"转账中"),
		TRAN_STATUS_PART_SUCCESS(4,"转账部分成功"),
		TRAN_STATUS_EXCEPTION(5,"异常"),
		TRAN_DEBiT_SUCCESS(6,"代发扣款成功"),
		TRAN_ORDER_FAIL_REFUND(7,"交易失败,退款");
		
		int code;
		String desc;

		TransferOrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static TransferOrderState valueOf(int code){			
			switch (code) {
			case 0:
				return TRAN_STATUS_INIT;
			case 1:
				return TRAN_STATUS_FAIL;
			case 2:
				return TRAN_STATUS_SUCCESS;
			case 3:
				return TRAN_STATUS_IN;
			case 4:
				return TRAN_STATUS_PART_SUCCESS;
			case 5:
				return TRAN_STATUS_EXCEPTION;
			case 6:
				return TRAN_DEBiT_SUCCESS;
			case 7:
				return TRAN_ORDER_FAIL_REFUND;
			default:	
				return null;
			}			
		}
	}
	
	public static enum ChargeOrderState{
		CHARGE_STATUS_INIT(0,"初始态"),
		CHARGE_STATUS_IN(1,"充值中"),
		CHARGE_STATUS_FAIL(2,"充值失败"),
		CHARGE_STATUS_SUCCESS(3,"充值成功"),
		CHARGE_STATUS_EXCEPTION(4,"充值异常");
		int code;
		String desc;

		ChargeOrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static ChargeOrderState valueOf(int code){			
			switch (code) {
			case 0:
				return CHARGE_STATUS_INIT;
			case 1:
				return CHARGE_STATUS_IN;
			case 2:
				return CHARGE_STATUS_FAIL;
			case 3:
				return CHARGE_STATUS_SUCCESS;
			case 4:
				return CHARGE_STATUS_EXCEPTION;
			default:	
				return null;
			}			
		}
	}
	
	public static enum TransferType{
		TRAN_BANLANCE_TO_BANLANCE(1,"余额到余额"),
		TRAN_BANLANCE_TO_BANK(2,"余额到银行"),
		TRAN_BANK_TO_BANLANCE(3,"银行到余额"),
		TRAN_BANK_TO_BANK(4,"银行到银行");
		int code;
		String desc;

		TransferType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static TransferType valueOf(int code){			
			switch (code) {
			case 1:
				return TRAN_BANLANCE_TO_BANLANCE;
			case 2:
				return TRAN_BANLANCE_TO_BANK;
			case 3:
				return TRAN_BANK_TO_BANLANCE;
			case 4:
				return TRAN_BANK_TO_BANK;
			default:	
				return null;
			}			
		}
	}
	
	public static enum InnerTransferType{
		C2C(1,"用户到用户转账"),
		C2B(2,"用户到商户转账"),
		B2C(3,"商户到用户转账"),
		B2B(4,"商户到商户转账");
		int code;
		String desc;

		InnerTransferType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		public static InnerTransferType valueOf(int code){			
			switch (code) {
			case 1:
				return C2C;
			case 2:
				return C2B;
			case 3:
				return B2C;
			case 4:
				return B2B;
			default:	
				return null;
			}			
		}
	}
	
	public static enum RefundType{
		B2C(1,"b2c交易退款");
		int code;
		String desc;

		RefundType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		public static RefundType valueOf(int code){			
			switch (code) {
			case 1:
				return B2C;
			default:	
				return null;
			}			
		}
	}
	
	public static enum RefundOrderState{
		REFUND_STATUS_INIT(0,"初始态"),
		REFUND_STATUS_IN(1,"退款中"),
		REFUND_STATUS_FAIL(2,"退款失败"),
		REFUND_STATUS_SUCCESS(3,"退款成功"),
		REFUND_STATUS_EXCEPTION(4,"退款异常");
		int code;
		String desc;

		RefundOrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static RefundOrderState valueOf(int code){			
			switch (code) {
			case 0:
				return REFUND_STATUS_INIT;
			case 1:
				return REFUND_STATUS_IN;
			case 2:
				return REFUND_STATUS_FAIL;
			case 3:
				return REFUND_STATUS_SUCCESS;
			case 4:
				return REFUND_STATUS_EXCEPTION;
			default:	
				return null;
			}			
		}
	}
	
	public static enum CallBackOrderState{
		SUCCESS(1,"订单成功"),
		FAIL(2,"订单失败"),
		EXCEPTION(3,"订单异常"),
		ING(4,"订单回调中");
		int code;
		String desc;

		CallBackOrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static CallBackOrderState valueOf(int code){			
			switch (code) {
			case 1:
				return SUCCESS;
			case 2:
				return FAIL;
			case 3:
				return EXCEPTION;
			case 4:
				return ING;
			
			default:	
				return null;
			}			
		}
	}
	
	public static enum NotifyState{
		SUCCESS(1,"回调成功"),
		FAIL(2,"回调失败"),
		EXCEPTION(3,"回调异常");
		int code;
		String desc;
	
		NotifyState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
	
		public int getCode() {
			return code;
		}
	
		public void setCode(int code) {
			this.code = code;
}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static NotifyState valueOf(int code){			
			switch (code) {
			case 1:
				return SUCCESS;
			case 2:
				return FAIL;
			case 3:
				return EXCEPTION;
			
			default:	
				return null;
			}			
		}
	}
	
	public static enum ActFlowTradeType{
		TRANSFER_ACT(1,"账户迁移"),
		CHARGE(2,"充值"),
		TRANSFER(3,"转账"),
		REFUND(4,"退款"),
		SETTLE(5,"结算"),
		BIND_CARD(6,"快捷支付绑卡"),
		CONSUME(7,"消费"),
		PAYFEE(8,"手续费"),
		WITHDRAW(9,"提现"),
		DISTRIBUTE(10,"代发"),
		RABATECHARGE(11,"返利金提现加款"),
		ORDERFAILREFUND(12,"交易失败退款");
		int code;
		String desc;
		
		ActFlowTradeType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
	
		public int getCode() {
			return code;
		}
	
		public void setCode(int code) {
			this.code = code;
}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static ActFlowTradeType valueOf(int code){			
			switch (code) {
			case 1:
				return TRANSFER_ACT;
			case 2:
				return CHARGE;
			case 3:
				return TRANSFER;
			case 4:
				return REFUND;
			case 5:
				return SETTLE;
			case 6:
				return BIND_CARD;
			case 7:
				return CONSUME;
			case 8:
				return PAYFEE;
			case 9:
				return WITHDRAW;
			case 10:
				return DISTRIBUTE;
			case 11:
				return RABATECHARGE;
			case 12:
				return ORDERFAILREFUND;
			
			default:	
				return null;
			}			
		}
		
	}
	
	public static enum IdCardType{
		IC_IDCARD(0,"身份证"),
		IC_PASSPORT(1,"护照"),
		IC_OFFICER_PASS(2,"军官证"),
		IC_HM_VISITOR_PASS(3,"港澳居民往来内地通行证"),
		IC_T_VISITOR_PASS(4,"台湾居民往来内地通行证");
				
		int code;
		String desc;
		
		IdCardType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
	
		public int getCode() {
			return code;
		}
	
		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		public static IdCardType valueOf(int code){			
			switch (code) {
			case 0:
				return IC_IDCARD;
			case 1:
				return IC_PASSPORT;
			case 2:
				return IC_OFFICER_PASS;
			case 3:
				return IC_HM_VISITOR_PASS;
			case 4:
				return IC_T_VISITOR_PASS;
			default:	
				return null;
			}			
		}
		
		
	}
	
	public static enum CardPayType {
		ONLINE_BANK(1, "网银"),
		QUICK_PAY(2, "快捷支付"),	
		WITHDRAW(6, "提现");
		
		private final int value;
		private final String desc;
		
		CardPayType(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static CardPayType valueOf(int value){
			switch (value) {
			case 1:			
				return ONLINE_BANK;
			case 2:
				return QUICK_PAY;
			case 6:
				return WITHDRAW;
			default:
				return null;
			}		
		}
	}
	
	public static enum VerifyCodeStatus{
		SUCCESS(0, "验证码输入正确"),
		RETRY(1, "验证确输入错误，请重新输入"),
		FAILED(2, "验证码输入错误");
		
		private final int value;
		private final String desc;
		
		VerifyCodeStatus(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static VerifyCodeStatus valueOf(int value){
			switch (value) {
			case 0:			
				return SUCCESS;
			case 1:
				return RETRY;
			case 2:
				return FAILED;
			default:
				return null;
			}		
		}
	}
	
	public static enum BaseBusinessStatus{
		SUCCESS(1, "成功"),
		FAILED(2, "失败"),
		EXCEPTION(3, "异常"),
		PAYING(4, "交易中");
		
		private final int value;
		private final String desc;
		
		BaseBusinessStatus(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static BaseBusinessStatus valueOf(int value){
			switch (value) {
			case 1:			
				return SUCCESS;
			case 2:
				return FAILED;
			case 3:
				return EXCEPTION;
			case 4:
				return PAYING;
			default:
				return null;
			}		
		}
	}
	
	public static enum TransferBusinessID{

		CHARGE(1, "充值"),
		PERSON2PERSON(2,"个人转个人"),
		DISTRIBUTE(3, "代发"),
		REFUND(4,"退款"),
		;
		
		private final int value;
		private final String desc;
		
		TransferBusinessID(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static TransferBusinessID valueOf(int value){
			switch (value) {
			case 1:

				return CHARGE;
			case 2:			

				return PERSON2PERSON;
			case 3:

				return DISTRIBUTE;
			case 4:

				return REFUND;
			default:
				return null;
			}		
		}
	}
	
	public static enum  FinanceTradeOrderType{	
		TRADE_ORDER(1,"交易"),
		TRANSFER_ORDER(2,"转账"),
		REFUND_ORDER(3,"退款"),
		WITHDRAW_ORDER(4,"提现");
		int code;
		String desc;

		FinanceTradeOrderType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static FinanceTradeOrderType valueOf(int code){			
			switch (code) {
			case 1:
				return TRADE_ORDER;
			case 2:
				return TRANSFER_ORDER;
			case 3:
				return REFUND_ORDER;
			case 4:
				return WITHDRAW_ORDER;
			default:
				return null;
			}			
		}
	}
	
	public static enum  FinanceOrderState{	
		SUCCESS(3,"成功"),
		FAIL(4,"失败"),
		EXCEPTION(5,"异常");
		int code;
		String desc;

		FinanceOrderState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static FinanceOrderState valueOf(int code){			
			switch (code) {
			case 3:
				return SUCCESS;
			case 4:
				return FAIL;
			case 5:
				return EXCEPTION;
			default:
				return null;
			}			
		}
	}
	
	public static enum  TradeIfUserPwd{	
		NOTUSE(1,"不使用"),
		USE(2,"使用");
		int code;
		String desc;
	
		TradeIfUserPwd(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
	
		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static TradeIfUserPwd valueOf(int code){			
			switch (code) {
			case 1:
				return NOTUSE;
			case 2:
				return USE;
			default:
				return null;
			}			
		}
	}

	public static enum  OrderSettleType{	
		PROMPTLY(1,"立即结算"),
		TIMING(2,"定时结算");
		int code;
		String desc;

		OrderSettleType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static OrderSettleType valueOf(int code){			
			switch (code) {
			case 1:
				return PROMPTLY;
			case 2:
				return TIMING;
			default:
				return null;
			}			
		}
	}

	public static enum  OrderSettleState{	
		NOTSTATE(0,"未结算"),
		STATEING(1,"结算中"),
		SUCCESS(2,"结算成功"),
		FAILED(3,"结算失败");
		int code;
		String desc;

		OrderSettleState(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static OrderSettleState valueOf(int code){			
			switch (code) {
			case 0:
				return NOTSTATE;
			case 1:
				return STATEING;
			case 2:
				return SUCCESS;
			case 3:
				return FAILED;
			default:
				return null;
			}			
		}
	}

	public static enum  WithdrawWay{	
		SHORTCUT(1,"快捷支付"),
		BANKCARD (2,"提现银行卡"),
		ALIPAY(3,"提现支付宝");
		int code;
		String desc;

		WithdrawWay(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static WithdrawWay valueOf(int code){			
			switch (code) {
			case 1:
				return SHORTCUT;
			case 2:
				return BANKCARD;
			case 3:
				return ALIPAY;
			default:
				return null;
			}			
		}
	}

	public static enum RiskTradeType{
		
	}
	
	
	public static enum RefundOrderType {
			
		CHARAGE(1, "充值退款"),
		TRADE(2, "余额支付退款"),
		CHARGE_TRADE(3,"充值交易退款");
		
		private final int value;
		private final String desc;
		
		RefundOrderType(int value, String desc){
			this.value = value;
			this.desc = desc;
		}
		 
		public int getValue() {
			return value;
		}
		
		public String getDesc() {
			return desc;
		}

		public static RefundOrderType valueOf(int value){
			switch (value) {
			case 1:
				return CHARAGE;
			case 2:
				return TRADE;
			case 3:
				return CHARGE_TRADE;
			default:
				return null;
			}		
		}
	}
	
	public static enum  TradeMessageType{	
		CHARGE(1,"充值"),
		B2C(2,"交易"),
		TRANSFER(3,"转账"),
		SETTLE(4,"结算"),
		WITHDRAW(5,"提现"),
		REFUND(6,"退款");
		int code;
		String desc;
		
		TradeMessageType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
		
		public int getCode() {
			return code;
		}
		
		public void setCode(int code) {
			this.code = code;
		}
		
		public String getDesc() {
			return desc;
		}
		
		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static TradeMessageType valueOf(int code){			
			switch (code) {
			case 1:
				return CHARGE;
			case 2:
				return B2C;
			case 3:
				return TRANSFER;
			case 4:
				return SETTLE;
			case 5:
				return WITHDRAW;
			case 6:
				return REFUND;
			default:
				return null;
			}			
		}
	}
	
	public static enum  DumpRecordType{	
		B2C(1,"交易"),
		WITHDRAW(2,"提现"),
		REFUND(3,"退款"),
		CHARGE(4,"充值"),
		TRANSFER(5,"转账"),
		TRADEFLOW(6,"交易流水");
		int code;
		String desc;
		
		DumpRecordType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}
		
		public int getCode() {
			return code;
		}
		
		public void setCode(int code) {
			this.code = code;
		}
		
		public String getDesc() {
			return desc;
		}
		
		public void setDesc(String desc) {
			this.desc = desc;
		}	
		
		public static DumpRecordType valueOf(int code){			
			switch (code) {
			case 1:
				return B2C;
			case 2:
				return WITHDRAW;
			case 3:
				return REFUND;
			case 4:
				return CHARGE;
			case 5:
				return TRANSFER;
			case 6:
				return TRADEFLOW;
			default:
				return null;
			}			
		}
	}
	
}
